package com.wxj.book.cms.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wxj.book.cms.dao.CommentVoMapper;
import com.wxj.book.cms.service.CommentVoService;
import com.wxj.book.cms.vo.CommentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentVoServiceImpl implements CommentVoService {
    @Autowired
    private CommentVoMapper commentVoMapper;

    /**
     * 查询所有
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public PageInfo<CommentVo> getAll(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<CommentVo> comments = commentVoMapper.getAll();
        PageInfo<CommentVo> pageInfo = new PageInfo<>(comments);
        return pageInfo;
    }
}
